﻿@{
    ViewBag.Title = "安全简报明细";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@section scripts{
    <script src="~/Areas/Senv/ViewModels/Senv.com.js"></script>
    <script src="~/Areas/Senv/ViewModels/Senv.Aqjb.edit.js"></script>
    <script src="~/Content/js/jquery-plugin/xheditor/xheditor-1.1.14-zh-cn.min.js"></script>
    <script src="~/Content/js/jquery-plugin/fineuploader-3.7.1/jquery.fineuploader-3.7.1.min.js"></script>
    <link href="~/Content/js/jquery-plugin/fineuploader-3.7.1/fineuploader-3.7.1.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
//         $(window).load(function() {
//            //动态改变高度
//            var iHeight = $(this).height() - 160 ;
//            if (iHeight < 0 ) iHeight = 400;
//            document.getElementById("xhe0_iframearea").style.height=iHeight + "px";
//            document.getElementById("xhe0_iframearea").style.width=$(this).width() + "px";
//        });
//        $(window).resize(function(){
//            var iHeight = $(this).height() - 160 ;
//            if (iHeight < 0 ) iHeight = 400;
//            document.getElementById("xhe0_iframearea").style.height= iHeight + "px";
//            document.getElementById("xhe0_iframearea").style.width=$(this).width() + "px";
//        });
        var data = @Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(Model));
        if (data.form != null)
            $("#Aqjb_Jbnr").xheditor().setSource(data.form.Aqjb_Jbnr);
        
         var viewModel = function(){ 
              var self = this;
              Senv.viewModel.edit.apply(this, arguments);
              this.createUploader = function()
                {
                     var uploader = new qq.FineUploader({
                      element: document.getElementById('fine-uploader'),
                      request: {
                        endpoint:'/api/qms/FileContent/postfile'
                      },
                       text: {
                          uploadButton: '请选择上传文件'
                      },
                      multiple: false, //是否为多文件上传
                       callbacks: {
                            onComplete: function (id, fileName, responseJSON) {
                            //filepath = filePath, filetype = fileType };
                             var filePath = responseJSON.filepath;
                             var filetype = responseJSON.filetype;
                             self.form.Aqjb_Fjpath(filePath); 
                             self.form.Aqjb_FjName(fileName); 
                            }
                     }
                    });
                }
                this.createUploader();
         }
         ko.bindingViewModel(new viewModel(data));
        //获得焦点
        $("#Aqjb_Jbnr").xheditor().focus();
    </script>
}
 <div class="z-toolbar">
        <a id="a_save" href="#" plain="true" class="easyui-linkbutton" icon="icon-save" data-bind="click:saveClick,linkbuttonDisable:readonly" title="保存">保存</a>
        <a id="a_undo" href="#" plain="true" class="easyui-linkbutton" icon="icon-undo" data-bind="click:rejectClick,linkbuttonDisable:readonly" title="撤消">撤消</a>
        <a id="a_audit" href="#" plain="true" class="easyui-linkbutton" icon="icon-user-accept" data-bind="click:auditClick,easyuiLinkbutton:approveButton" title="确认">确认</a>
       @* <a id="a_printer" href="#" plain="true" class="easyui-linkbutton" icon="icon-printer" title="打印" data-bind="click:printClick">打印</a>*@
        <div class="datagrid-btn-separator"></div>
        <a id="a_first" href="#" plain="true" class="easyui-linkbutton" icon="icon-resultset_first" data-bind="click:firstClick,linkbuttonEnable:scrollKeys.firstEnable" title="第一条"></a> 
        <a id="a_previous" href="#" plain="true" class="easyui-linkbutton" icon="icon-resultset_previous" data-bind="click:previousClick,linkbuttonEnable:scrollKeys.previousEnable" title="上一条"></a> 
        <a id="a_next" href="#" plain="true" class="easyui-linkbutton" icon="icon-resultset_next" data-bind="click:nextClick,linkbuttonEnable:scrollKeys.nextEnable" title="下一条"></a> 
        <a id="a_last" href="#" plain="true" class="easyui-linkbutton" icon="icon-resultset_last" data-bind="click:lastClick,linkbuttonEnable:scrollKeys.lastEnable" title="最后一条"></a> 
    </div>
         
        <div id="master" class="container_12" data-bind="inputwidth:1">
        <div class="clear"></div>
        <div class="grid_1 lbl required">单据编号</div>
        <div class="grid_3 val"><input type="text" data-bind="value:form.Aqjb_BillNo,readOnly:true" class="z-txt readonly"/></div>
        <div class="grid_1 lbl ">简报日期 </div>
        <div class="grid_3 val"><input type="text" data-bind="dateboxValue:form.Aqjb_Jbrq,dateboxReadOnly:readonly" class="easyui-datebox z-txt"   /></div>
        <div class="grid_1 lbl">关键字 </div>
        <div class="grid_3 val "><input type="text" data-bind="value:form.Aqjb_JbKeys,readOnly:readonly" class="z-txt"  /></div>
        <div class="clear"></div>

        <div class="grid_1 lbl required">简报标题</div>
        <div class="grid_3 val required "><input type="text" data-bind="value:form.Aqjb_Jbbt,readOnly:readonly"   class="z-txt easyui-validatebox" required="true" /></div>
        <div class="grid_1 lbl ">简报期数 </div>
        <div class="grid_3 val "><input type="text"  data-bind="value:form.Aqjb_Jbqs,readOnly:readonly"  class="z-txt"/></div>
        <div class="grid_1 lbl">备注说明 </div>
        <div class="grid_3 val required"><input type="text" data-bind="value:form.Aqjb_Remark,readOnly:readonly" class="z-txt"  /></div>
        <div class="clear"></div>
        <div class="grid_1 lbl ">简报内容</div>
        <div class="grid_12"><textarea id = "Aqjb_Jbnr"   data-bind="value:form.Aqjb_Jbnr,readOnly:readonly" style=" margin-top:20px; overflow:auto;width:100%;height:260px;" class="xheditor {skin:'default'}"   rows="1" cols="1" > </textarea></div>
        <div class="clear"></div>
        <div class="grid_12" id="fine-uploader"></div>
        <div class="clear"></div>
        <div class="grid_1 lbl ">附件路径 </div>
        <div class="grid_3 val "><input type="text"   data-bind="value:form.Aqjb_Fjpath,readOnly:true"  class="z-txt readonly"/></div>
        <div class="grid_1 lbl ">附件名称 </div>
        <div class="grid_3 val "><input type="text"   data-bind="value:form.Aqjb_FjName,readOnly:true"  class="z-txt readonly"/></div>
        <div class="clear"></div>
    </div>


      <script type="text/template" id="qq-template">
  <div class="qq-uploader-selector qq-uploader">
    <div class="qq-upload-drop-area-selector qq-upload-drop-area" qq-hide-dropzone>
      <span>Drop files here to upload</span>
    </div>
    <div class="qq-upload-button-selector qq-upload-button">
      <div>上传附件</div>
    </div>
    <span class="qq-drop-processing-selector qq-drop-processing">
      <span>Processing dropped files...</span>
      <span class="qq-drop-processing-spinner-selector qq-drop-processing-spinner"></span>
    </span>
    <ul class="qq-upload-list-selector qq-upload-list">
      <li>
        <div class="qq-progress-bar-container-selector">
          <div class="qq-progress-bar-selector qq-progress-bar"></div>
        </div>
        <span class="qq-upload-spinner-selector qq-upload-spinner"></span>
        <span class="qq-edit-filename-icon-selector qq-edit-filename-icon"></span>
        <span class="qq-upload-file-selector qq-upload-file"></span>
        <input class="qq-edit-filename-selector qq-edit-filename" tabindex="0" type="text">
        <span class="qq-upload-size-selector qq-upload-size"></span>
        <a class="qq-upload-cancel-selector qq-upload-cancel" href="#">Cancel</a>
        <a class="qq-upload-retry-selector qq-upload-retry" href="#">Retry</a>
        <a class="qq-upload-delete-selector qq-upload-delete" href="#">Delete</a>
        <span class="qq-upload-status-text-selector qq-upload-status-text"></span>
      </li>
    </ul>
  </div>
</script>